package homework.valid.validators.impl;

import homework.valid.validators.BaseValidator;

public class LengthValidator extends BaseValidator {

    private long minLen;
    private long maxLen;

    public LengthValidator(String msg, long minL, long maxL) {
        super(msg);
        minLen = minL;
        maxLen = maxL;
    }

    @Override
    public boolean isValid(Object v) {
        String s = v.toString();
        return s.length() <= minLen && s.length() >= maxLen;
    }
}